package metier;

import java.sql.ResultSet;
import java.sql.SQLException;
import mappage.CL_mp_disque;

public class CL_disque {
	
	private ResultSet rs;
	private CL_mp_disque disque;
	
	//@SuppressWarnings({ "unchecked", "rawtypes" })
	public String[][] M_charger_disques(int id){
		
		disque = new CL_mp_disque();
		
		int a = 0;
		int taille = 0;		
		
		rs = disque.M_mp_charger_disques(id);

		try {
			rs.last();
			taille = rs.getRow();
			rs.beforeFirst();
		} catch (SQLException e1) {
			e1.printStackTrace();
		}
		if(taille != 0){
			try {
				String[][] data = new String[taille][4];
				while(rs.next()){

					data[a][0] = ""+rs.getInt("ID_DISQUE");
					data[a][1] = rs.getString("NOM");
					data[a][2] = ""+rs.getInt("ANNEE");
					data[a][3] = ""+rs.getInt("ID_GENRE");
					
					//System.out.println(data[a][0]);
					//System.out.println(data[a][1]);
					//System.out.println(data[a][2]);
					//System.out.println(data[a][3]);
					
					
					a++;
				}
				
				return data;
			} 
			catch (SQLException e) {
				e.printStackTrace();
			}
		}
		String[][] data = new String[1][1];	
		data[0][0] = "Aucun cd";
		return data;
	}
	
}
